<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateLaohaTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        // Create table for storing cates
        Schema::create('laoha_tables', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->unique();
            $table->string('model')->nullable()->default(null);
			$table->tinyInteger('allow_cate')->default(0);
			$table->string('items')->nullable()->default(null);
			$table->text('setting')->nullable()->default(null);
            $table->timestamps();
        });

        // Create table for storing cates
        Schema::create('laoha_cates', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('parent_id')->default(0);
            $table->integer('order')->default(0);
            $table->string('name');
            $table->string('title');
			$table->text('sub')->nullable()->default(null);
			$table->text('extend')->nullable()->default(null);
			$table->integer('table_id');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::drop('laoha_tables');
		Schema::drop('laoha_cates');
    }
}
